var stepId = $CertusJsonAjax.getStepInstanceId();
var processId = $CertusJsonAjax.getProInstanceId();

$CertusFormAjax.ajax("findJbWorkList",{"processId":processId}, function(result){
    var data = result.data;
    $$scope.createUser = data.createUser;
    $$scope.proName = data.proName;
    $$scope.beginTime = data.beginTime;
    $$scope.start = data.start;
    $$scope.endTime = data.endTime;
    $$scope.end = data.end;
    $$scope.vacationDay = data.vacationDay;
    $$scope.totalHour = data.totalHour;
    $$scope.comments = data.comments;
    $$scope.opinionMsg = data.opinionMsg;
    $$scope.id = data.id;
});
$(".agree").on('click',function () {
    var opinionMsg = $("#opinionMsg").val();
    // 开启
    var index = layer.load(1);
    $CertusFormAjax.ajax('agreeJbwork',{"processId":processId,
        "stepId":stepId,"opinionMsg":opinionMsg,"id":$$scope.id},function () {
        //关闭
        layer.close(index);
        layer.msg("审批成功");
        window.history.back();
    });
});

$(".rback").on('click',function () {
    var opinionMsg = $("#opinionMsg").val();
    $CertusFormAjax.ajax('rbackJbwork',{"processId":processId,
        "stepId":stepId,"opinionMsg":opinionMsg,"id":$$scope.id},function () {
        layer.msg("退回成功");
        window.history.back();
    });
});

$(".unagree").on('click',function () {
    var opinionMsg = $("#opinionMsg").val();
    $CertusFormAjax.ajax('unagreeJbwork',{"processId":processId,
        "stepId":stepId,"opinionMsg":opinionMsg,"id":$$scope.id},function () {
        layer.msg("审批成功");
        window.history.back();
    });
})